package com.dangdang.ddframe.reg.spring.namespace;


import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 描述:
 * zk配置
 *
 * @author Yangjy
 * @date 2018-03-26
 */
@Configuration
@Data
@Slf4j
public class ZkRegCenterConfiguration {

    @Bean
    public static SpringZookeeperRegistryCenter springZookeeperRegistryCenter(
            @Value("${elastic.job.serverLists}") String serverLists,
            @Value("${elastic.job.namespace}") String namespace,
            @Value("${elastic.job.baseSleepTimeMilliseconds}") String baseSleepTimeMilliseconds,
            @Value("${elastic.job.maxSleepTimeMilliseconds}") String maxSleepTimeMilliseconds,
            @Value("${elastic.job.maxRetries}") String maxRetries) {
        log.info("serverLists:" + serverLists);
        SpringZookeeperConfigurationDto springZookeeperConfigurationDto = new SpringZookeeperConfigurationDto(
                serverLists, namespace, baseSleepTimeMilliseconds, maxSleepTimeMilliseconds, maxRetries);
        springZookeeperConfigurationDto.setSessionTimeoutMilliseconds("");
        springZookeeperConfigurationDto.setConnectionTimeoutMilliseconds("");
        springZookeeperConfigurationDto.setDigest("");
        springZookeeperConfigurationDto.setNestedPort("");
        springZookeeperConfigurationDto.setNestedDataDir("");
        springZookeeperConfigurationDto.setLocalPropertiesPath("");
        springZookeeperConfigurationDto.setOverwrite("");
        return new SpringZookeeperRegistryCenter(springZookeeperConfigurationDto);
    }


}
